home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / Bit.man < prev    next >
Encoding:
Text File  |  1989-02-01  |  6.4 KB  |  201 lines

  1.  
  2.  
  3.  
  4. Bit                   C Library Procedures                    Bit
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NNAAMMEE
  11.      Bit_Set,  Bit_Clear,   Bit_IsSet,   Bit_IsClear,   Bit_Copy,
  12.      Bit_Zero,        Bit_FindFirstSet,       Bit_FindFirstClear,
  13.      Bit_Intersect, Bit_Union, Bit_AnySet, Bit_Expand, Bit_Alloc,
  14.      Bit_Free - bit operations
  15.  
  16. SSYYNNOOPPSSIISS
  17.      #include <bit.h>
  18.  
  19.      BBiitt__SSeett(_b_i_t_N_u_m, _a_r_r_a_y_P_t_r)
  20.  
  21.      BBiitt__CClleeaarr(_b_i_t_N_u_m, _a_r_r_a_y_P_t_r)
  22.  
  23.      BBiitt__IIssSSeett(_b_i_t_N_u_m, _a_r_r_a_y_P_t_r)
  24.  
  25.      BBiitt__IIssCClleeaarr(_b_i_t_N_u_m, _a_r_r_a_y_P_t_r)
  26.  
  27.      BBiitt__CCooppyy(_n_u_m_B_i_t_s, _s_r_c_A_r_r_a_y_P_t_r, _d_e_s_t_A_r_r_a_y_P_t_r)
  28.  
  29.      BBiitt__ZZeerroo(_n_u_m_B_i_t_s, _a_r_r_a_y_P_t_r)
  30.  
  31.      BBiitt__FFiinnddFFiirrssttSSeett(_n_u_m_B_i_t_s, _a_r_r_a_y_P_t_r)
  32.  
  33.      BBiitt__FFiinnddFFiirrssttCClleeaarr(_n_u_m_B_i_t_s, _a_r_r_a_y_P_t_r)
  34.  
  35.      Boolean
  36.      BBiitt__IInntteerrsseecctt(_n_u_m_B_i_t_s, _a_r_r_a_y_1_P_t_r, _a_r_r_a_y_2_P_t_r, _d_e_s_t_A_r_r_a_y_P_t_r)
  37.  
  38.      Boolean
  39.      BBiitt__UUnniioonn(_n_u_m_B_i_t_s, _a_r_r_a_y_1_P_t_r, _a_r_r_a_y_2_P_t_r, _d_e_s_t_A_r_r_a_y_P_t_r)
  40.  
  41.      Boolean
  42.      BBiitt__AAnnyySSeett(_n_u_m_B_i_t_s, _a_r_r_a_y_P_t_r)
  43.  
  44.      int *
  45.      BBiitt__EExxppaanndd(_n_e_w_N_u_m_B_i_t_s, _o_l_d_N_u_m_B_i_t_s, _o_l_d_A_r_r_a_y_P_t_r)
  46.  
  47.      BBiitt__AAlllloocc(_n_u_m_B_i_t_s, _a_r_r_a_y_P_t_r)
  48.  
  49.      BBiitt__FFrreeee(_a_r_r_a_y_P_t_r)
  50.  
  51. AARRGGUUMMEENNTTSS
  52.      int       _b_i_t_N_u_m         (in)      The number in  the  array
  53.                                         of the bit to manipulate.
  54.  
  55.      int       _n_u_m_B_i_t_s        (in)      The number of bits in all
  56.                                         the  *_a_r_r_a_y_P_t_r  variables
  57.                                         passed.
  58.  
  59.      int       *_a_r_r_a_y_P_t_r      (in,out)  The array of bits.
  60.  
  61.  
  62.  
  63. Sprite v.1.0       Printed:  January 31, 1989                   1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Bit                   C Library Procedures                    Bit
  71.  
  72.  
  73.  
  74.      int       *_s_r_c_A_r_r_a_y_P_t_r   (in)      The array of bits  to  be
  75.                                         copied.
  76.  
  77.      int       *_d_e_s_t_A_r_r_a_y_P_t_r  (out)     The array to  which  bits
  78.                                         are copied.
  79.  
  80.      int       *_a_r_r_a_y_1_P_t_r     (in)      The first source array in
  81.                                         an  intersection or union
  82.                                         operation.
  83.  
  84.      int       *_a_r_r_a_y_2_P_t_r     (in)      The second  source  array
  85.                                         in   an  intersection  or
  86.                                         union operation.
  87.  
  88.      int       _n_e_w_N_u_m_B_i_t_s     (in)      The number  of  bits  the
  89.                                         expanded array must hold.
  90.  
  91.      int       _o_l_d_N_u_m_B_i_t_s     (in)      The number of bits in the
  92.                                         old array.
  93.  
  94.      int       *_o_l_d_A_r_r_a_y_P_t_r   (in)      The bit array that is now
  95.                                         too small.
  96.  
  97. _________________________________________________________________
  98.  
  99. DDEESSCCRRIIPPTTIIOONN
  100.      These procedures manipulate integer arrays of bits.  All the
  101.      procedures  operate on integer arrays and _n_u_m_B_i_t_s is used to
  102.      compute the size of *_a_r_r_a_y_P_t_r. If _n_u_m_B_i_t_s is not a  multiple
  103.      of the number of bits in an integer, it is rounded up to the
  104.      nearest multiple.
  105.  
  106.      BBiitt__SSeett sets the _b_i_t_N_u_m bit in *_a_r_r_a_y_P_t_r.
  107.      BBiitt__CClleeaarr clears the _b_i_t_N_u_m bit in *_a_r_r_a_y_P_t_r.
  108.  
  109.      The predicates BBiitt__IIssSSeett and BBiitt__IIssCClleeaarr test to see if  the
  110.      _b_i_t_N_u_m bit is set or cleared.
  111.  
  112.      BBiitt__ZZeerroo clears all bits in *_a_r_r_a_y_P_t_r.
  113.      BBiitt__CCooppyy copies *_s_r_c_A_r_r_a_y_P_t_r to *_d_e_s_t_A_r_r_a_y_p_t_r.
  114.  
  115.      BBiitt__FFiinnddFFiirrssttSSeett and BBiitt__FFiinnddFFiirrssttCClleeaarr return the index  of
  116.      the  rightmost  bit in *_a_r_r_a_y_P_t_r that is set or cleared. The
  117.      index begins at 0 and -1 is returned if no  set  or  cleared
  118.      bit is found.
  119.  
  120.      BBiitt__IInntteerrsseecctt and BBiitt__UUnniioonn find the intersection and union,
  121.      respectively, of the two bit arrays and stores the result in
  122.      the third array. They return TRUE  if  the  intersection  or
  123.      union  is  non-empty. For both functions, if _d_e_s_t_A_r_r_a_y_P_t_r is
  124.      NULL, the result is not stored anywhere.
  125.  
  126.      BBiitt__AAnnyySSeett examines the array to see if any of the  bits  is
  127.      on,  returning  TRUE  if  at  least  one  is  set  and FALSE
  128.  
  129.  
  130.  
  131. Sprite v.1.0       Printed:  January 31, 1989                   2
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. Bit                   C Library Procedures                    Bit
  139.  
  140.  
  141.  
  142.      otherwise.
  143.  
  144.      BBiitt__AAlllloocc and BBiitt__FFrreeee are used to  allocate  and  free  bit
  145.      arrays.  BBiitt__AAlllloocc creates an array to hold _n_u_m_B_i_t_s bits and
  146.      sets _a_r_r_a_y_P_t_r to point at it. The  array  initially  has  no
  147.      bits  set.  BBiitt__FFrreeee  deallocates a previously-allocated bit
  148.      array.
  149.  
  150.      BBiitt__EExxppaanndd takes an existing,  dynamically-allocated  array,
  151.      _o_l_d_A_r_r_a_y_P_t_r,  along  with its width, _o_l_d_N_u_m_B_i_t_s, and expands
  152.      it to contain _n_e_w_N_u_m_B_i_t_s bits, returning a  pointer  to  the
  153.      expanded  array. The array may or may not have moved. If the
  154.      array was moved, the old array was deallocated at  the  same
  155.      time. The new bits are initially all 0.
  156.  
  157. KKEEYYWWOORRDDSS
  158.      bit, set, clear, copy, zero
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197. Sprite v.1.0       Printed:  January 31, 1989                   3
  198.  
  199.  
  200.  
  201.